package com.dance.java8.day01.date;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;

public class TestSimpleDateFormatNewApi {

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        ExecutorService executorService = Executors.newFixedThreadPool(10);

        // 格式化类
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");

        // localDate
        Callable<LocalDate> callable = () -> LocalDate.parse("20161218",dateTimeFormatter);

        List<Future<LocalDate>> list = new ArrayList<>();

        for (int i = 0; i < 10; i++) {
            list.add(executorService.submit(callable));
        }

        for (Future<LocalDate> dateFuture : list) {
            System.out.println(dateFuture.get());
        }

        executorService.shutdown();

    }

}
